﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SalesModel;

namespace SalesController.ClassesDB
{
    [Serializable]
    public class CustomersDB
    {
        DAOFactory daoFactory = null;
        DAOCustomer daoCustomer = null;
        public CustomersDB()
        {
            daoFactory = DAOFactory.getDAOFactory(DBConnection.dbType);
            daoCustomer = daoFactory.getDAOCustomer(); //Polimorfismo
        }
        public List<Customer> Values
        {
            get { return daoCustomer.queryAll(); }
        }

        public void Add(Customer c)
        {
            daoCustomer.add(c);
        }

        public int Size
        {
            get { return daoCustomer.count(); }
        }

        public void Delete(int i)
        {
            daoCustomer.delete(i);
        }
        public void Update(Customer c)
        {
            daoCustomer.update(c);
        }
        public Customer QueryById(int customerId)
        {
            return daoCustomer.queryById(customerId);
        }
    }
}
